package com.huatai.verity.controller;

import com.huatai.common.api.R;
import com.huatai.verity.entity.ScreenUser;
import com.huatai.verity.model.ScreenQueryModel;
import com.huatai.verity.service.ScreenUserService;
import com.huatai.verity.vo.LoginScreenUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;

/**
 * @author chenwj
 */
@RestController
@RequestMapping("/screen/user")
@Api(value = "大屏用户管理",tags = "大屏用户管理")
@RefreshScope
public class ScreenUserController {

	@Autowired
	private ScreenUserService screenUserService;

	@PostMapping("/save")
	@ApiOperation("新增/更新大屏用户信息")
	public R saveScreenUser(@ApiParam(value = "大屏用户", required = true) @RequestBody ScreenUser screenUser){
		return R.status(screenUserService.saveScreenUser(screenUser));
	}

	@PostMapping("/login")
	@ApiOperation("大屏登录")
	public R< LoginScreenUserVO > login(@ApiParam(value = "scName", required = true) @RequestParam String scName,
										@ApiParam(value = "scPermissionId", required = true) @RequestParam String scPermissionId,
										@ApiParam(value = "客户端时间 yyyy-MM-DD HH:mm:ss", required = true) @RequestParam String clientTime){
		return screenUserService.login(scName, scPermissionId, clientTime);
	}

	@PostMapping("/list")
	@ApiOperation("获取大屏用户列表")
	public R getList(@ApiParam(value = "查询模型", required = true) @RequestBody ScreenQueryModel screenQueryModel){
		return screenUserService.getListPage(screenQueryModel);
	}



}
